﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _01_委托
{
    public class PersonList
    {
        IList<Person> _listperosn;
        public void Add(Person p)
        {
            _listperosn.Add(p);
        }
        public static bool CompareId(Person p1, Person p2)
        {
            return p1.Id > p2.Id ? true : false;
        }
        public static void Sort<T>(IList<T> arraylist, Func<T, T, bool> campareFunc)
        {
            for (int i = 0; i < arraylist.Count-1; i++)
            {
                if (campareFunc(arraylist[i], arraylist[i + 1]))
                {
                    T temp = arraylist[i];
                    arraylist[i] = arraylist[i + 1];
                    arraylist[i + 1] = temp;
                }

            }

        }
    }
}
